import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [

  {
    title: '合同号',
    align: "center",
    dataIndex: 'contractNo'
  },
  {
    title: '包装通知单',
    align: "center",
    dataIndex: 'packageNo'
  },
  // {
  //   title: '发票头编号',
  //   align: "center",
  //   dataIndex: 'invoiceHeaderId'
  // },
  {
    title: '零件编码',
    align: "center",
    dataIndex: 'partNo'
  },
  {
    title: '零件名称',
    align: "center",
    dataIndex: 'partName'
  },
  {
    title: '数量',
    align: "center",
    dataIndex: 'qty'
  },
  {
    title: '单位',
    align: "center",
    dataIndex: 'unit'
  },
  {
    title: '零件英文名',
    align: "center",
    dataIndex: 'partNameEn'
  },
  {
    title: '财务性质',
    align: "center",
    dataIndex: 'accountNature'
  },
  {
    title: '备注',
    align: "center",
    dataIndex: 'remark'
  },
  {
    title: '开票含税单价（元）',
    align: "center",
    dataIndex: 'kphsdj'
  },
  {
    title: '无税单价（元）',
    align: "center",
    dataIndex: 'wsdj'
  },
  {
    title: '无税金额（元）',
    align: "center",
    dataIndex: 'wsje'
  },
  {
    title: '税率(%)',
    align: "center",
    dataIndex: 'taxRate'
  },
  {
    title: '税额(元)',
    align: "center",
    dataIndex: 'taxAmount'
  },
  {
    title: '价税合计(元)',
    align: "center",
    dataIndex: 'jshj'
  },
  {
    title: '开票备注',
    align: "center",
    dataIndex: 'invoiceRemark'
  },
  {
    title: '是否报关',
    align: "center",
    dataIndex: 'customsFlag_dictText'
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "合同号",
    field: 'contractNo',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: "包装通知单",
    field: 'packageNo',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: "是否报关",
    field: 'customsFlag',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "customs_flag"
    },
    colProps: { span: 6 },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  // {
  //   label: '发票头编号',
  //   field: 'invoiceHeaderId',
  //   component: 'Input',
  //   dynamicRules: ({ model, schema }) => {
  //     return [
  //       { required: true, message: '请输入发票头编号!' },
  //     ];
  //   },
  // },
  {
    label: '零件编码',
    field: 'partNo',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入零件编码!' },
      ];
    },
  },
  {
    label: '零件名称',
    field: 'partName',
    component: 'Input',
  },
  {
    label: '数量',
    field: 'qty',
    component: 'InputNumber',
  },
  {
    label: '单位',
    field: 'unit',
    component: 'Input',
  },
  {
    label: '零件英文名',
    field: 'partNameEn',
    component: 'Input',
  },
  {
    label: '财务性质',
    field: 'accountNature',
    component: 'Input',
  },
  {
    label: '备注',
    field: 'remark',
    component: 'Input',
  },
  {
    label: '开票含税单价（元）',
    field: 'kphsdj',
    component: 'InputNumber',
  },
  {
    label: '无税单价（元）',
    field: 'wsdj',
    component: 'InputNumber',
  },
  {
    label: '无税金额（元）',
    field: 'wsje',
    component: 'InputNumber',
  },
  {
    label: '税率(%)',
    field: 'taxRate',
    component: 'InputNumber',
  },
  {
    label: '税额(元)',
    field: 'taxAmount',
    component: 'InputNumber',
  },
  {
    label: '价税合计(元)',
    field: 'jshj',
    component: 'InputNumber',
  },
  {
    label: '开票备注',
    field: 'invoiceRemark',
    component: 'Input',
  },
  {
    label: '是否报关',
    field: 'customsFlag',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "customs_flag"
    },
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
